﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml.Linq;
using System.Web.DynamicData;
using MadeInPortugal.DataSet1TableAdapters;
using MadeInPortugal;
using MadeInPortugal.Class;


namespace MadeInPortugalWebApplication
{
    public partial class User : System.Web.UI.Page
    {
        
        protected void Page_Load(object sender, EventArgs e)
        {   
            if (!IsPostBack)
            {
                CheckUserNavigation();
            }

        }

        private void CheckUserNavigation()
        {
            int UserId = 0;
            String UserType;
            if (Session["UserType"] != null)
            {
                UserType = Session["UserType"].ToString();
                int.TryParse(Session["UserId"].ToString(), out UserId);

                switch (Session["UserType"].ToString())
                {
                    case "Admin":
                        Response.Redirect("AdminProductList.aspx");
                        break;
                    case "Enterprise":
                        navigationTab.Visible = true;
                        myProducts.Visible = true;
                        break;
                    case "Normal":
                        navigationTab.Visible = true;
                        myProducts.Visible = false;
                        break;
                    default:
                        navigationTab.Visible = false;
                        myProducts.Visible = false;
                        break;
                }

            }
            else
            {
                navigationTab.Visible = false;
                myProducts.Visible = false;
            }
        }


    }
}


